//==================================================================
//  Copyright (C) 2006  Davide Pasca
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
//==================================================================
/// @file m5d_types.h
///
///
///
//==================================================================

#ifndef M5D_TYPES_H
#define M5D_TYPES_H

#include "psys.h"
#include "pvector.h"
#include "pmatrix.h"

#define M5D_VOID_INDEX		(-1)

//typedef float	m5d_vector[4]	 ALIGN16;
//typedef float	m5d_matrix[4][4] ALIGN16;


#define M5D_MAX_BONES_PER_VERTEX		4
#define M5D_NULL_TNODE_IDX				255
#define M5D_MAX_STRIP_LEN				255					// arrays are being made of this, keep it low !
#define M5D_BONEMASK_NOBONES			0xffffffff
#define M5D_BONEMASK_GROUP_FLG_RIGID	1

//==================================================================
namespace M5D
{

//==================================================================
///
//==================================================================
namespace VType
{
	enum VType
	{
		NONE = -1,
		POS = 0,
		TEX,
		COL,
		NOR,
		N
	};
};

//==================================================================
///
//==================================================================
class StateSynch
{
	static u_int	_revision_init_id;

	u_int	_revision_id;

public:
	StateSynch() :
	  _revision_id(_revision_init_id++)
	{
	}

	void	SetChanged()
	{
		++_revision_id;
	}

	bool	IsSynchronized( int other_rev_id ) const
	{
		return _revision_id == other_rev_id;
	}

	void	SynchronizeFrom( const StateSynch &other )
	{
		_revision_id = other._revision_id;
	}
};

};

#endif
